package com.oazon.common.util;

import java.lang.reflect.Field;

public class ReflectionUtil {

	public enum IpAssignment {
		/*
		 * Use statically configured IP settings. Configuration can be accessed
		 * with linkProperties
		 */
		STATIC,
		/* Use dynamically configured IP settigns */
		DHCP,
		/*
		 * no IP details are assigned, this is used to indicate that any
		 * existing IP settings should be retained
		 */
		UNASSIGNED
	}

	public enum ProxySettings {
		/*
		 * No proxy is to be used. Any existing proxy settings should be
		 * cleared.
		 */
		NONE,
		/*
		 * Use statically configured proxy. Configuration can be accessed with
		 * linkProperties
		 */
		STATIC,
		/*
		 * no proxy details are assigned, this is used to indicate that any
		 * existing proxy settings should be retained
		 */
		UNASSIGNED,
		/*
		 * Use a Pac based proxy.
		 */
		PAC
	}

	public static final String CONFIGURED_NETWORKS_CHANGED_ACTION = "android.net.wifi.CONFIGURED_NETWORKS_CHANGE";

	public static final String LINK_CONFIGURATION_CHANGED_ACTION = "android.net.wifi.LINK_CONFIGURATION_CHANGED";

	public static final int INVALID_NETWORK_ID = -1;

	public static final int DISABLED_UNKNOWN_REASON = 0;

	public static final int DISABLED_DNS_FAILURE = 1;

	public static final int DISABLED_DHCP_FAILURE = 2;

	public static final int DISABLED_AUTH_FAILURE = 3;

	public static final int DISABLED_ASSOCIATION_REJECT = 4;

	static public Object getDeclaredField(Object obj, String name)
			throws NoSuchFieldException, IllegalArgumentException,
			IllegalAccessException {
		Object out = null;
		Field f = obj.getClass().getDeclaredField(name);
		if (!f.isAccessible())
			f.setAccessible(true);
		out = f.get(obj);
		return out;
	}

	static public int getDeclaredFieldReturnInt(Object obj, String name)
			throws NoSuchFieldException, IllegalAccessException,
			IllegalArgumentException {
		int out = 0;
		Field f = obj.getClass().getDeclaredField(name);
		if (!f.isAccessible())
			f.setAccessible(true);
		out = f.getInt(obj);

		return out;
	}

}
